<?php
class ModelCatalogYmm extends Model {
	public function getymm($ymm_id) {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "caryear c1 LEFT JOIN " . DB_PREFIX . "carmodel c2 ON (c1.carmodel_id = c2.carmodel_id) LEFT JOIN carmake c3 ON ( c2.carmake_id = c3.carmake_id )  WHERE c1.caryear_id = '" . (int)$ymm_id  . "'");
	
		return $query->row;	
	}
	
	public function getymms() {
		$ymm = $this->cache->get('ymm.' . (int)$this->config->get('config_store_id'));
		
		if (!$ymm) {
			$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "carmake ORDER BY carmake_name, LCASE(carmake_name) ASC");
	
			$ymm = $query->rows;
			
			$this->cache->set('ymm.' . (int)$this->config->get('config_store_id'), $ymm);
		}
		
		return $ymm;
	} 
}
?>